package com.springboot.springbootweb.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.springboot.springbootweb.mapper.JcUserMapper;
import com.springboot.springbootweb.model.JcUser;
import com.springboot.springbootweb.service.JcUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author gwj
 * @since 2021-09-11
 */

@Service
public class JcUserServiceImpl extends ServiceImpl<JcUserMapper, JcUser> implements JcUserService {

    @Autowired
    JcUserMapper jcUserMapper;

    @Transactional
    @Override
    @Cacheable(value = "alluser")
    public List<JcUser> getAllUserPage() {
        return jcUserMapper.getAllUserPage();
    }

    @Override
    @DS("db2")
    public IPage getAll(Page page, int id) {
        return jcUserMapper.getAll(page, id);
    }

}
